1. Field of the Invention
The present invention relates to a method of encoding and compressing a file, and more particularly, to a method and apparatus for controlling a compression rate of a file.
2. Description of the Related Art
In general, when an image file is generated using a digital photographing device, an encoding process is performed in order to convert an analog image to a digital image. The encoding process is a process for recognizing an image file and converting the image file into a reproducible file format in a digital device such as a computer, a mobile phone, or a personal digital assistant (PDA). Also, when a user wants to transmit an image file from a first digital device to a second digital device, the encoding process includes a series of processes for editing and converting the image file into another format by using the first digital device in order to reproduce the edited and converted image file in the second digital device.
Such an encoding process often includes compressing the image file. A conventional compression method is performed by roughly predicting a compression rate in accordance with empirical rules, compressing an image by applying the predicted compression rate to the image, checking that a file size of the compressed image is within a target file size range and, if the file size is not in the target file size range, repeating the predicting and the compressing until the file size is in the target file size range. However, a correlation between the compression rate and the file size is not linear and may differ in accordance with a file type. Thus, it may be difficult to accurately and easily predict the compression rate.